﻿using System;
using System.IO;
using System.Text;

namespace zhihu {
    public static class LogHelper {
        public static void Info(string info) {
            var name = DateTime.Now.ToString("yyyy-MM-dd") + ".txt";
            var logRootPath = Path.Combine(System.Windows.Forms.Application.StartupPath, "Log");
            if (!Directory.Exists(logRootPath))
                Directory.CreateDirectory(logRootPath);
            var sw = new StreamWriter(logRootPath + "/" + name, true, Encoding.UTF8);
            sw.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "  " + info);
            sw.Close();
        }

        public static void Info(string format, params object[] args) {
            var info = string.Format(format, args);
            Info(info);
        }
    }
}